﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Inaction.Core;
using Inaction.Mapping;

namespace Inaction.Business.Security.Abstract
{
    [Table("MenuRole", SelectView = "MenuRole_V"), DisplayName(""), Serializable]
    public abstract class MenuRoleV<T> : Inaction.Business.Entity<T> where T : MenuRoleV<T>, new()
    {
        #region MenuRole属性
        public static readonly Property<Guid?> IdProperty = RegisteProperty<Guid?>(p => p.Id);
        Guid? _id;
        [Column("Id"), DisplayName("菜单角色"), Display(Description = "菜单角色")]
        public Guid? Id
        {
            get { return _id; }
            internal set { SetProperty(IdProperty, ref _id, value); }
        }
        public static readonly Property<Guid?> RoleIdProperty = RegisteProperty<Guid?>(p => p.RoleId);
        Guid? _roleId;
        [Column("RoleId"), DisplayName("角色"), Display(Description = "角色")]
        public Guid? RoleId
        {
            get { return _roleId; }
            set { SetProperty(RoleIdProperty, ref _roleId, value); }
        }
        public static readonly Property<Guid?> MenuIdProperty = RegisteProperty<Guid?>(p => p.MenuId);
        Guid? _menuId;
        [Column("MenuId"), DisplayName("菜单"), Display(Description = "菜单")]
        public Guid? MenuId
        {
            get { return _menuId; }
            set { SetProperty(MenuIdProperty, ref _menuId, value); }
        }


        #endregion

        #region 其他表属性
        public static readonly Property<String> CodeProperty = RegisteProperty<String>(p => p.Code);
        String _code;
        [Column("Code", NeedUpdate = false), DisplayName("代码"), Display(Description = "代码")]
        public String Code
        {
            get { return _code; }
            internal set { SetProperty(CodeProperty, ref _code, value); }
        }
        public static readonly Property<String> NameProperty = RegisteProperty<String>(p => p.Name);
        String _name;
        [Column("Name", NeedUpdate = false), DisplayName("名称"), Display(Description = "名称")]
        public String Name
        {
            get { return _name; }
            internal set { SetProperty(NameProperty, ref _name, value); }
        }

        #endregion
    }
}
